#include <stdio.h>
#include <stdint.h>
#include <uv.h>

static uv_timer_t timer;

void timer_cb(uv_timer_t* handle) {
    printf("timer callback\n");
}

void start_timer(uv_timer_t* handle, uint32_t time) {
    uv_timer_start(handle, timer_cb, 0, time);
}

void timer_cb2(uv_timer_t* handle) {
    start_timer(&timer, 5000);
}

int main(void) {
    uv_loop_t* loop = uv_default_loop();
    uv_timer_init(loop, &timer);
    start_timer(&timer, 20);
    uv_timer_t timer2;
    uv_timer_init(loop, &timer2);
    uv_timer_start(&timer2, timer_cb2, 2000, 0);

    uv_run(loop, UV_RUN_DEFAULT);
    return 0;
}
